//
//  NSDate+extension.m
//  HowToDo
//
//  Created by 胡坤 on 2017/1/7.
//  Copyright © 2017年 KY. All rights reserved.
//

#import "NSDate+extension.h"

@implementation NSDate (extension)
+(NSString *)dateWithTimeString:(NSNumber* )timeNM
{
    NSDate * addDate = [NSDate dateWithTimeIntervalSince1970:timeNM.longLongValue];
    
    //获取当前时间rili
    NSCalendar *calendar = [NSCalendar currentCalendar];
    
    
    NSDateComponents * components = [calendar components:NSCalendarUnitDay fromDate:addDate toDate:[NSDate date] options:0];
    
    if (components.day <1)
    {
        return @"今天";
    }
    
    NSDateFormatter* formatter = [[NSDateFormatter alloc] init];
    [formatter setDateFormat:@"yyyy-MM-dd HH:MM:ss"];
    
    NSString* string = [formatter stringFromDate:addDate];
    
    
  
    
    
    
    return string;
}




@end
